#include "QFindpsw.h"

QFindPSW::QFindPSW(QWidget *parent) : QWidget(parent)
{
    //【1】窗口本身属性
    this->setFixedSize(450,723);
    LabelOfBackground = new QLabel(this);
    LabelOfBackground->setGeometry(0,0,450,723);
    LabelOfBackground->setObjectName("FindPSW");
    this->setWindowIcon(QIcon(":/ALL/Image/ALL/Cat.png"));
    this->setWindowFlags(Qt::FramelessWindowHint);

    //【2】关闭和最小化按钮
    CloseBtn = new QToolButton(this);
    MinimizeBtn = new QToolButton(this);
    CloseBtn->setGeometry(400,0,45,45);
    MinimizeBtn->setGeometry(370,0,45,45);
    CloseBtn->setObjectName("CloseBtn");
    MinimizeBtn->setObjectName("MinimizeBtn");
    connect(CloseBtn,SIGNAL(clicked()),this,SLOT(close()));
    connect(MinimizeBtn,&QToolButton::clicked,this,&QFindPSW::showMinimized);

    //【3】文字和输入框
    LabelOfPhoneNumber =new QLabel(this);
    LineeditOfPhoneNumber = new QLineEdit(this);
    LabelOfVerificationCode = new QLabel(this);
    LineeditOfVerificationCode = new QLineEdit(this);
    LabelOfNewPSW = new QLabel(this);
    LineeditOfNewPSW = new QLineEdit(this);
    LabelOfMakeSurePSW = new QLabel(this);
    LineeditOfMakeSurePSW = new QLineEdit(this);
    LabelOfPhoneNumber->setText(QString::fromUtf8("手机号:"));
    LabelOfVerificationCode->setText(QString::fromUtf8("验证码:"));
    LabelOfNewPSW->setText(QString::fromUtf8("新密码:"));
    LabelOfMakeSurePSW->setText(QString::fromUtf8("确认新密码:"));
    LineeditOfPhoneNumber->setPlaceholderText(QString::fromUtf8("请输入与您账号相关联的手机号"));
    LineeditOfVerificationCode->setPlaceholderText(QString::fromUtf8("请输入短信验证码"));
    LineeditOfNewPSW->setPlaceholderText(QString::fromUtf8("请输入新密码"));
    LineeditOfMakeSurePSW->setPlaceholderText(QString::fromUtf8("请确认密码"));
    LineeditOfNewPSW->setEchoMode(QLineEdit::Password);
    LineeditOfMakeSurePSW->setEchoMode(QLineEdit::Password);

    LabelOfPhoneNumber->setObjectName("RegisterLabel");
    LabelOfVerificationCode->setObjectName("RegisterLabel");
    LabelOfNewPSW->setObjectName("RegisterLabel");
    LabelOfMakeSurePSW->setObjectName("RegisterLabel");
    LineeditOfPhoneNumber->setObjectName("RegisterLineedit");
    LineeditOfVerificationCode->setObjectName("RegisterLineedit");
    LineeditOfNewPSW->setObjectName("RegisterLineedit");
    LineeditOfMakeSurePSW->setObjectName("RegisterLineedit");

    //【4】修改密码按钮、退出按钮和验证码按钮
    BtnOfFindPSW = new QPushButton(this);
    BtnOfBackToLogin = new QPushButton(this);
    BtnOfGetVerificationCode = new QPushButton(this);

    BtnOfFindPSW->setText(QString::fromUtf8("修改密码"));
    BtnOfBackToLogin->setText(QString::fromUtf8("返回登录界面"));
    BtnOfGetVerificationCode->setText(QString::fromUtf8("获取验证码"));

    BtnOfBackToLogin->setObjectName("RegisterBtnOfText");
    BtnOfFindPSW->setObjectName("RegisterBtn");
    BtnOfGetVerificationCode->setObjectName("RegisterBtn");

//    connect(BtnOfBackToLogin,&QPushButton::clicked,this,QFindPSW::GoLogin);
    connect(BtnOfBackToLogin,SIGNAL(clicked()),this,SLOT(GoLogin()));

    //【5】控件布局
    int first_x = 25;//第一列控件的x,y坐标
    int first_y = 315;
    int first_width = 80;//第一列控件的长高
    int first_height = 45;
    int second_x = first_x + first_width + 10;//第二列控件坐标的x(y同第一列控件坐标的y)
    int second_width = 400 - first_width - 10;//第二列控件的宽(高同第一列控件的高)
    int Vinterval = first_height+25;//控件间的垂直间隔
    LabelOfPhoneNumber->setGeometry(first_x,first_y,first_width,first_height);
    LineeditOfPhoneNumber->setGeometry(second_x,first_y,second_width,first_height);

    LabelOfVerificationCode->setGeometry(first_x,first_y+Vinterval,first_width,first_height);
    LineeditOfVerificationCode->setGeometry(second_x,first_y+Vinterval,second_width,first_height);
    BtnOfGetVerificationCode->setGeometry(365-first_width,first_y+Vinterval,first_width+60,first_height);

    LabelOfNewPSW->setGeometry(first_x,first_y+Vinterval*2,first_width,first_height);
    LineeditOfNewPSW->setGeometry(second_x,first_y+Vinterval*2,second_width,first_height);

    LabelOfMakeSurePSW->setGeometry(first_x,first_y+Vinterval*3,first_width,first_height);
    LineeditOfMakeSurePSW->setGeometry(second_x,first_y+Vinterval*3,second_width,first_height);

    BtnOfFindPSW->setGeometry(first_x,first_y+Vinterval*4,400,first_height);
    BtnOfBackToLogin->setGeometry(first_x,first_y+Vinterval*5,200,first_height);

    //【6】设置样式
    QReadQSS::setStyle(":/QSS/QSS/Rester.qss");

    //【7】信号与槽
}

void QFindPSW::GoLogin()
{
    emit SIGNALOfGoToLogin();
    this->close();
}
